Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Python Matplotlib Interview Questions and Answers

Question: How can you set the limits of the x-axis and y-axis in Matplotlib?
Answer: Use `plt.xlim()` and `plt.ylim()` functions to set the limits of the x-axis and y-axis, respectively.

Example:

plt.plot([1, 2, 3, 4], [10, 20, 25, 30])
plt.xlim(0, 5)
plt.ylim(0, 35)
plt.show()
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook